/*
 * 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙，邂逅框架梦]
 * 
 * https://zhiqim.org/project/zhiqim_framework/zhiqim_httpd.htm
 *
 * Zhiqim Httpd is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
package org.zhiqim.httpd.websocket;

import java.util.List;

import org.zhiqim.httpd.HttpContext;


/**
 * Websocket管理器定义
 *
 * @version v1.0.0 @author zouzhigang 2018-9-29 新建与整理
 */
public interface HttpWebSocketManager
{
    /** 获取管理器对应的上下文环境 */
    public HttpContext getContext();
    
    /********************************************************************/
    //开启和关闭
    /********************************************************************/
    
    /** 开启管理 */
    public void open();
    
    /** 关闭管理 */
    public void close();
    
    /*********************************************************************/
    //增加&删除&获取
    /*********************************************************************/
    
    /** 获取HttpWebsocket实现类 */
    public HttpWebSocketService getWebSocketService(String protocol);
    
    /** 获取协议名下所有连接 */
    public List<HttpWebSocket> get(String protocol);
    
    /** 获取协议名下某个用户的所有连接 */
    public List<HttpWebSocket> get(String protocol, String sessionId);
    
    /** 获取协议名下某个参数对应的值的连接 */
    public HttpWebSocket get(String protocol, String paramName, String paramValue);
    
    /** 由HttpWebsocketService增加连接关联到会话 */
    public void add(HttpWebSocket conn);
    
    /** 从连接中收到结束取消关联会话 */
    public void remove(HttpWebSocket conn);
}
